﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Retrofit.Core
{
    public abstract class Process
    {
        protected int m_type;
        protected bool m_remove;
        protected bool m_active;
        protected bool m_paused;
        protected bool m_initialUpdate;
        protected Process m_next;

        public int Type
        {
            get { return m_type; }
            set { m_type = value; }
        }

        public bool IsDead
        {
            get { return m_remove; }
            set { m_remove = value; }
        }

        public bool Active
        {
            get { return m_active; }
            set { m_active = value; }
        }

        public bool Paused
        {
            get { return m_paused; }
            set { m_paused = value; }
        }

        public Process Next
        {
            get { return m_next; }
            set { m_next = value; }
        }

        public bool IsInitialized
        {
            get { return m_initialUpdate; }
        }

        public virtual void TogglePause()
        {
            m_paused = !m_paused;
        }

        public void Remove()
        {
            m_remove = true;
        }

        public virtual void Initialize()
        {
        }
        
        public virtual void Update(GameTime gameTime)
        {
            if (!m_initialUpdate)
            {
                Initialize();
                m_initialUpdate = true;
            }
        }
    }
}
